package oom;
/**
 * 栈深度
 * 单个线程下，无论是由于栈帧太大还是虚拟机栈容量太小，当内存无法分配的时候，都会抛出stackoverflowerror异常
 * vm args:-Xss128k 
 * @author Ditto
 *
 */
public class JavaVmStackSOF {

	private int stackLength =1;
	
	public void stackLeak(){
		stackLength++;
		stackLeak();
	}
	
	public static void main(String[] args) {
		JavaVmStackSOF oom = new JavaVmStackSOF();
		try{
			oom.stackLeak();
		}catch(Throwable e){
			System.out.println("stack length:"+oom.stackLength);
			throw e;
		}
	}
}
